<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/better-scroll@1.0.1/dist/bscroll.min.js"></script>
    <title>Document</title>
</head>
<body>
    <!-- http://ustbhuangyi.github.io/better-scroll/doc/zh-hans/installation.html#script-%E5%8A%A0%E8%BD%BD -->
    <!-- https://www.jianshu.com/p/ccc8d4823438 -->
    <!-- https://blog.csdn.net/weixin_37719279/article/details/82084342 -->


    <div class="wrapper"> 
        <ul class="content" id="ul"> 
        <li>1</li> 
        <li>2</li>
        <li>3</li> 
        <li>4</li>
        <li>1</li> 
        <li>2</li>
        <li>1</li> 
        <li>2</li>
        <li>1</li> 
        <li>2</li>
        <li>1</li> 
        <li>2</li>
        <li>1</li> 
        <li>2</li>
        <li>3</li> 
        <li>4</li>
        <li>1</li> 
        <li>2</li>
        <li>1</li> 
        <li>2</li>
        <li>1</li> 
        <li>2</li>
        <li>1</li> 
        <li>2</li>
        <li>3</li>
         
         </ul>
    </div>


</body>
<script>
    var ul=document.getElementById("ul")
    var lis=ul.getElementsByTagName('li')
    for(let i=0;i<lis.length;i++){
        lis[i].style.left=i*80 +"px"
    }
    // https://better-scroll.github.io/docs/zh-CN/plugins/scroll-bar.html#%E7%A4%BA%E4%BE%8B

   setTimeout(()=>{
    new BScroll('.wrapper',{
        click: true,
        // https://blog.csdn.net/Anticipate_/article/details/94402873
        eventPassthrough: 'horizontal',//这是代表的横向滚动
        scrollbar:false
    })

   },500)
 
  

    

 
  
</script>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    .wrapper{
        width: 100%;
        height: 200px;
        background-color: aqua;
        overflow: hidden;     
    }
    .content{
       position: relative;
       height: 160px;
       overflow-x: scroll;
    }
    .content li{
       display: block;
       position: absolute;
       width: 80px;
       height: 150px;
       line-height: 150px;
       background-color: azure;
       padding: 0;
       border-right: 1px solid red;
       box-sizing: border-box;
       text-align: center;
     
    }
</style>
</html>